How I can assist in SAS Programming

  • Understand your business needs and formulate programmable rules
  • Select programming methodology and the best suited development environment
  • Insure smart programming techniques by leveraging functions and procs
  • Improve program efficiency and reduce processing time
  • Identify business processes suitable for automation using SAS Macro language and host scripting languages
  • Develop SAS programming standards suitable to your environment
  • Test and validate SAS programs to ensure they meet requirements and standards

Integrated Development Environment

SAS Display Manager System (DMS)
SAS Display Manager is an interactive programming environment key components of which are - program, log and output windows. Source code is developed in the program window and submitted to the SAS engine which immediately displays the log and relevant output in respective windows. Such interactive programming greatly speeds up code development. Once a process is developed it can be executed interactively or in batch mode. SAS DMS resides in the same environment where SAS system is installed.

SAS Enterprise Guide (EG)
SAS Enterprise Guide is a client software separate from the SAS System, that offers organization and controls of SAS code development. It is well suited where many programmers work on a project and the team includes all levels of SAS users. It offers a visual development environment where software processes can be created using a drag and drop interface and includes a GUI query builder and reort writer. There are numerous built in tasks that can be used instead of writing custom code. It also provides source code change tracking and version control.

SAS Studio
While the above two environments are native applications on a host, SAS Studio runs in a browser. It has some of the functionality offered in Enterprise Guide and is suited for beginner and intermediate SAS users. Some SAS products like SAS University Edition offer this IDE alone.

SAS Data

A SAS Dataset is similar to a table with rows and columns. Datasets can be indexed and views can be built as in database software.

A SAS Data Step consists of instructions to process individual data records. The statements between the keywords "Data" and "run;" form an implicit loop and are executed for every record in the data step. Language syntax in a SAS data step use constructs like functions, call routines, arrays, formats, conditional processing, merging data, reading and writing external files. By selecting suitable functions and formats complex logical constructs can be implemented in simple statements. The set of records processed within a Data step is stored in a SAS Dataset.

SAS Procedures

"Procs", abbreviation for procedures, operate on sets of records (datasets). In most situations data is pre-processed in a data step before calling a Proc. Base SAS alone has 75 Procs while all other SAS products combined have about 210 Procs. Most data processing tasks can be accomplished by one or a combination of several Procs.

For example there is a "Proc Sort" to sort data, there is a "Proc Report" to report and print data, there is a "Proc Univariate" for descriptive statistics, "Proc Reg" for regression analysis, etc. With so many Procs available, it is usually a lot simpler to identify one or several Procs that can do the job than build program logic in a data step.

Writing efficient SAS programs requires planning the sequence in which Data Step and Proc based processing takes place. Having an understanding of the scope of various Procs is necessary to determine whether processing can take place via a Proc or has to be done in a Data Step. Procs are more efficient and requires fewer lines of code, whereas Data Step programming offers greater flexibility.

Macro Language

SAS Macro facility is employed to automate processes in SAS software. SAS macro language can conditionally and iteratively modify SAS language statements or even create new ones. It reduces the amount of program statements that have to be written to accomplish a task. SAS macro facility gives the ability to break a large SAS language process into smaller sub-processes and link them to achieve efficiencies.

Output Delivery System

As the name implies, Output Delivery System in the SAS System deals with the presentation of results. Typically results from SAS are generated by printing, graphing or analytical procedures. These procedures logically process data in an input SAS dataset based on user parameters specified in the SAS code and yield output objects in the form of tables and graphs. ODS makes it possible to select output object and customize their format suited to different destinations such as a browser, printer, spreadsheet, PDF, image files among others.

Handling output objects from a proc output is useful when building automatic analytical processes. For instance results from a process maybe directed to a formatted Excel spreadsheet. When a process is run repeatedly resultant data can be captured in the same output format without any manual formatting. ODS, in addition to making results visually appealing, is very useful for automating analytical processes.

SAS SQL

SQL within SAS software is SAS implementation of Structured Query Language via a procedure (Proc SQL). It is an enhancment of ANSI standard SQL and well suited to processing data stored in a relational format either in a SAS dataset or Relational Database software. SAS SQL can be used to query, subset, join, sort and group data without using Data steps or other Procs. It supports use of Data Step functions in Select statement bringing in the power of SAS language to SAS SQL language. In some cases it may be simpler to write code using SAS SQL. For instance it is easier to generate a cartesian product of two datasets using Proc SQL since that is the default output of a SQL join. However complex SQL code may not be as easy to main as data step code.

SQL Pass Thru facility is an extension of the SQL procedure that enables sending of DBMS specific SQL statements to an external database via SAS/Access products and retrieve results into a SAS dataset. By using DBMS specific SQL it can be more efficient to preprocess data in the DBMS and retrieve a resultset into SAS for further processing. It is therefore important to understand when SQL needs to be employed within SAS programs to derive maximum benefit.